const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = (env, argv) => {
    console.log(`${env}`);
    return {
        entry: `./src/${env.lxs}/main.js`,
        output: {
            filename: 'lxs.js',
            path: path.resolve(__dirname, `./dist/${env.lxs}`)
        },
        devtool: "eval",
        mode:'development',
        plugins: [
            new HtmlWebpackPlugin({
                template: path.resolve(__dirname, `./src/${env.lxs}/index.html`),
                filename: 'index.html',
            })
        ],
        optimization: {
            removeAvailableModules: false,
            removeEmptyChunks: false,
            splitChunks: false
        },
        devServer: {
            static: {
                directory: path.resolve(__dirname, `./dist/${env.lxs}`)
            },
            compress: true,
            port: 8090,
            open: ['index.html']
        }
    }

}